<template>
  <div>
    <el-row :gutter="20">
      <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
      <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
      <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
      <el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
    </el-row>
  </div>

</template>

<script>
  import { getProducts, addProduct, updateProduct,statusProduct,deleteProduct} from '@/api/product'
  export default {
    data() {
      return {
        product: {
          attributes: [{
            name: '',
          }],
          name: '',
          description:''
        },
        options: [{
          label: '文本',
          type: 0
        }, {
          label: '数值',
          type: 1
        }, {
          label: '枚举',
          type: 2
        }],
      };
    },
    methods: {
      submitForm(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            addProduct(this.dynamicValidateForm).then(response => {
              this.$router.push({ path: '/device/product'})
            })
          } else {
            console.log('error submit!!');
            return false;
          }
        });
      },
      resetForm(formName) {
        this.$refs[formName].resetFields();
      },
      removeDomain(item) {
        var index = this.dynamicValidateForm.attributes.indexOf(item)
        if (index !== -1) {
          this.dynamicValidateForm.attributes.splice(index, 1)
        }
      },
      addAttribute() {
        this.dynamicValidateForm.attributes.push({
          type: '',
          name:'',
          key: Date.now()
        });
      }
    }
  }
</script>

<style>

</style>
